package com.fzrskj.cloud.sdk.mini.server.auth;

import com.fzrskj.cloud.sdk.mini.server.MiniServerResult;
import com.fzrskj.cloud.sdk.mini.server.AuthSn;
import com.fzrskj.cloud.sdk.mini.server.MiniServerBase;
import com.fzrskj.cloud.sdk.mini.server.MiniServerConfig;
import com.restphp.java.utils.http.consts.HttpMethod;

import java.util.HashMap;
import java.util.Map;

/**
 * 认证服务.
 * Created by sofical on 2020/9/25.
 */
public class AuthService extends MiniServerBase {
    /**
     * construct.
     * @param miniServerConfig 微服务配置.
     */
    public AuthService (MiniServerConfig miniServerConfig) {
        super(miniServerConfig, "mimiServicePublicManageCheck");
    }

    /**
     * 验证token是否可用.
     * @param token token.
     * @return 验证结果.
     */
    public MiniServerResult authToken (String token) {
        //请求数据
        Map<String, Object> requestData = new HashMap<>();
        requestData.put("token", token);
        requestData.put("refresh", 0);

        //请求认证服务.
        return this.post(requestData);
    }
}
